<?php

namespace App\Admin\Actions\Aliyun;

use App\Admin\Forms\Aliyun\RecordRemarkForm;
use App\Models\Aliyun;
use Dcat\Admin\Grid\RowAction;
use Dcat\Admin\Widgets\Modal;
use Throwable;

class SetupDnsRemark extends RowAction
{
    protected string $title = '设置备注';

    public function __construct(protected Aliyun $aliyun)
    {
        parent::__construct();
    }

    /**
     * @throws Throwable
     */
    public function render(): string
    {
        return Modal::make()
            ->lg()
            ->centered()
            ->title($this->title)
            ->body(RecordRemarkForm::make()->payload(['record_id' => $this->getKey(), 'aliyun' => $this->aliyun]))
            ->button($this->title)
            ->render();
    }
}
